from selenium import webdriver
from selenium.webdriver.common.by import By
import  time
import os.path

driver = webdriver.Chrome()
path = os.path.join(os.path.abspath('html3'),'popup.html')
driver.get(path)

# alert
# driver.find_element(By.TAG_NAME,'button').click()
# time.sleep(2)
# alert=driver.switch_to.alert
# print(alert.text)
# alert.accept()

# confirm
driver.find_elements(By.TAG_NAME,'button')[1].click()
time.sleep(2)
confirm =driver.switch_to.alert
print(confirm.text)
confirm.accept()



#prompt
driver.find_elements(By.TAG_NAME,'button')[2].click()
time.sleep(2)
prompt=driver.switch_to.alert
print(confirm.text)
prompt.send_keys('啦啦啦')
prompt.dismiss()





time.sleep(2)
driver.quit()